<template>
  <div>
    <table>
      <tr>
        <th>编号</th>
        <th>品牌名称</th>
        <th>创建时间</th>
        <th>操作</th>
      </tr>

      <tr v-for="item in list" :key="item.id">
        <td>{{ item.id }}</td>
        <td>{{ item.name }}</td>
        <td>{{ item.time }}</td>
        <td><button @click="del(item.id)">删除</button></td>
      </tr>

      <tr v-show="list.length === 0">
        <td>没有数据咯</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        { id: 1, name: "奔驰", time: "2020-08-01" },
        { id: 2, name: "宝马", time: "2020-08-02" },
        { id: 3, name: "奥迪", time: "2020-08-03" },
      ],
    };
  },

  methods: {
    del(id) {
      this.list = this.list.filter((item) => item.id !== id);
    },
  },
};
</script>

<style>
</style>